//
//  MMSocialManager.h
//  MMShare
//
//  Created by qianqichao on 2018/3/15.
//  Copyright © 2018年 qianqichao. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class MMSocialShareResponse;
@class MMSocialUserInfoResponse;

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, MMSharePlatform)
{
    MMSharePlatform_Wechat                      = 1,
    MMSharePlatform_Timeline                    = 2,
    MMSharePlatform_QQ                          = 3,
    MMSharePlatform_Sina                        = 4,
    MMSharePlatform_Qzone                       = 5
};

typedef NS_ENUM(NSInteger, MMShareType)
{
    MMShareType_Web                             = 1,
    MMShareType_Image                           = 2
};

typedef void (^MMSocialRequestUserInfoCompletionHandler)(MMSocialUserInfoResponse * result, NSError *error);
typedef void (^MMSocialRequestCompletionHandler)(MMSocialShareResponse * result,NSError *error);
typedef void(^MMSocialSharePlatformSelectionBlock)(MMSharePlatform platformType,NSDictionary* userInfo);

@interface MMSocialManager : NSObject

@property (nonatomic, strong) NSError *fetchUserError;

+ (instancetype)defaultManager;

+ (BOOL)isInstallWeChat;
+ (BOOL)isInstallQQ;
+ (BOOL)isInstallWeibo;

- (void)initialConfigurationWithUMAppKey:(NSString *)umAppKey wechatAppKey:(NSString *)wechatAppKey wechatAppSecret:(NSString *)wechatAppSecret qqAppKey:(NSString *)qqAppKey qqAppSecret:(NSString *)qqAppSecret sinaAppKey:(NSString *)sinaAppKey sinaAppSecret:(NSString *)sinaAppSecret openLog:(BOOL)openLog;

- (void)shareMenu:(NSArray *)platforms callBack:(MMSocialSharePlatformSelectionBlock)callBack;

- (void)shareToPlatform:(MMSharePlatform)platform shareType:(MMShareType)shareType content:(NSString * )content link:(NSString * )link title:(NSString * )title data:(id )data viewController:(UIViewController * )viewController
             completion:(MMSocialRequestCompletionHandler)completion;

- (BOOL)handleOpenURL:(NSURL *)url options:(NSDictionary * )options;

- (void)getUserInfoWithPlatform:(MMSharePlatform)platform viewController:(UIViewController * )viewController completion:(MMSocialRequestUserInfoCompletionHandler)completion;

@end

NS_ASSUME_NONNULL_END
